<?php
/**
 * Created by PhpStorm.
 * User: leo
 * Date: 2018/5/11
 * Time: 0:54
 */
include '../classes/logincheck.php';
include "../classes/conn.php";
if(islogin()!='teacher_login'){
    die('error');
}
if($_POST['type']=='sub'){
    $query="delete from subsection where num='{$_POST['sub_num']}' and section='{$_POST['sec_num']}' and class='{$_POST['class_num']}' and teacher='{$_SESSION['t_num']}'";
    mysql_query($query);
    echo '1';
}
if($_POST['type']=="sec"){

    $query1="delete from section where num='{$_POST['sec_num']}' and class='{$_POST['class_num']}' and teacher='{$_SESSION['t_num']}'";
    mysql_query($query1);
    $query2="delete from subsection where section='{$_POST['sec_num']}' and class='{$_POST['class_num']}' and teacher='{$_SESSION['t_num']}'";
    mysql_query($query2);
    echo '1';

}